#pragma once

#include<iostream>

class Command
{
public:
    Command()
    { }

    std::string Exec(const std::string& command_str)
    {
        FILE* pf = popen(command_str.c_str(), "r");
        std::string res;
        if(pf == NULL)
        {
            res = command_str + "exec error";
        }
        else
        {
            char buffer[1024];
            while(fgets(buffer, sizeof(buffer), pf) != nullptr)
            {
                res += buffer;
            }
        }
        return res;
        pclose(pf);
    }
};